from selenium import webdriver
from selenium.webdriver.common.by import By
import time


# 下拉框
driver = webdriver.Firefox()
driver.get("https://www.baidu.com")

# //*[@id="s-usersetting-top"]
# /html/body/div[1]/div[2]/div[3]/span
# 设置
settings = driver.find_element(by=By.ID,value="s-usersetting-top")
settings.click()
time.sleep(3)

# 高级设置
high_setting = driver.find_element(by=By.XPATH,value='//*[@id="s-user-setting-menu"]/div/a[2]')
high_setting.click()
time.sleep(3)

# 全部时间
all_time = driver.find_element(by=By.XPATH,value='/html/body/div[1]/div[6]/div/div/div/div[2]/div/form/ul/li[2]/span[2]/div')
all_time.click()
time.sleep(3)

# 找到下拉框中的所有元素：最近一周，最近一月...
item = driver.find_element(by=By.CLASS_NAME,value="c-select-item")
print(item.text)


items = driver.find_elements(by=By.CLASS_NAME,value="c-select-item")
# 最近1月
items[3].click()
for i in items:
    print(i.text)

